﻿@model Model.Commodity
<html>
<head>
    <title>商品表单</title>
    <style>
        /* 设置整个页面的字体和背景色 */
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
        }

        /* 设置表单的宽度和居中对齐 */
        form {
            width: 500px;
            margin: 0 auto;
        }

        /* 设置表单中每个元素的边距和对齐方式 */
        p {
            margin: 10px 0;
            display: flex;
            align-items: center;
        }

        /* 设置表单中的标签的宽度和字体粗细 */
        label {
            width: 100px;
            font-weight: bold;
        }

        /* 设置表单中的输入框和文本域的宽度和边框样式 */
        input, textarea {
            width: 350px;
            border: 1px solid #ccc;
            padding: 5px;
        }

        /* 设置表单中的按钮的颜色和圆角 */
        button {
            background-color: #0099ff;
            color: white;
            border-radius: 5px;
            padding: 10px 20px;
        }

        #typeclass {
            width: 5px;
            height: 5px;
        }
    </style>
</head>
<body>
    <center><h1>修改商品</h1></center>
    <form action="EditCommodity" method="post" enctype="multipart/form-data">
        <input type= "hidden" name = "cid" value =@Model.ID>
        <input type="hidden" name="bid" value=@Model.bussiness!.ID />
        <p>
            <label for="name">商品名：</label>
            <input type="text" id="name" name="name" value=@Model.Name required>
        </p>
        <p>
            <label for="price">商品价格：</label>
            <input type="number" id="price" name="price" value=@Model.Price min="0" required>
        </p>
        <p>
            <label for="discribe">商品描述：</label>
            <textarea id="discribe" name="discribe" rows="5" cols="40">@Model.Describe</textarea>
        </p>
        <p>
            <label for="position">发货地址：</label>
            <input type="text" id="position" name="position" value=@Model.Position>
        </p>
        <p>
            <label for="totalnumber">商品数量：</label>
            <input type="number" id="totalnumber" name="totalnumber" min="1" required value=@Model.TotalNumber>
        </p>
        <p>
            <label for="img">商品图片：</label>
            <input type="file" id="img" name="img" value=@Model.Imgs accept="image/*">
        </p>
        @{
            if (ViewBag.ComType != null)
            {
                <p>@Html.Label("商品类别:")</p>
                foreach (SelectListItem r in ViewBag.ComType)
                {
                    if(r.Selected==true)
                    {
                        <input style="width:15px;height:15px;padding:0px;" type="radio" id=@r.Text name="tid" value=@r.Value checked="checked">
                        <label for=@r.Text>@r.Text</label>
                    }
                    else
                    {
                        <input style="width:15px;height:15px;padding:0px;" type="radio" id=@r.Text name="tid" value=@r.Value>
                        <label for=@r.Text>@r.Text</label>
                    }
                }
            }
        }
        <p>
            <button type="submit">提交</button>
        </p>
    </form>
</body>
</html>
